package com.duobaoyu.dby.supply.db.repository.message;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.duobaoyu.dby.supply.db.entity.message.ChannelMessage;
import com.duobaoyu.dby.supply.db.entity.message.ChannelMessageOrder;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;

import java.util.Collection;
import java.util.List;

/**
 * @author liyang
 * @version 1.0.0
 * @ClassName ChannelMessageService
 * @Description 渠道消息记录
 * @createTime 16:23:00 2023/09/27
 */
public interface ChannelMessageRepository {
	/**
	 * 修改消息状态
	 *
	 * @param channelMessageId
	 * @param messageStatus
	 * @return
	 */
	boolean updateMessageStatusById(String channelMessageId, Integer messageStatus,Class<? extends ChannelMessage> channelMessageClass);

	List<? extends ChannelMessage> findByUniqueKey(String uniqueKey, Class<? extends ChannelMessage> channelMessageClass);

	boolean existsByUniqueKey(String uniqueKey, Class<? extends ChannelMessage> channelMessageClass);

	ChannelMessage save(ChannelMessage channelMessage);

	Collection<ChannelMessage> insertAll(List<ChannelMessage> channelMessages);

	ChannelMessage getById(String channelMessageId, Class<? extends ChannelMessage> channelMessageClass);

    Page<ChannelMessage> page(Page<Object> page, Query query);

    Boolean updateChannelMessageStatus(Query query, Update update);

	List<ChannelMessageOrder> channelMessageOrderList(int skipCount, int limit,List<Integer> messageStatusList, Integer lteRetryCount);

	void resetRetryCount(String channelMessageId, Class<? extends ChannelMessage> clazz);
}
